======= diagram2() =====

''string **diagram2**(string //Type//, array //Data//, [array //Options//])''

With the function ''diagram2()'' data can be visualized which have been calculated before in the questionnaire -- e.g. from the user's data via ''[[:en:create:functions:value|value()]]'' or via ''[[:en:create:functions:statistic|statistic()]]''.


Currently this function can only display a polarity profile.

  * //Type//\\ Defines the type of chart:
    * '''polar''' -- polarity profile

  * //Data//\\ The data is specified as a two-dimensional array, i.e. an array with one array per data series (see example).
  * //Options// A number of options are available for controlling the display. Some of these only apply to certain types of chart. The options are specified as a named array (see example).
    * int //width// -- Width of the diagram (in pixels)
    * int //height// -- Height of the diagram (in pixels)
    * int //min// -- Minimum of the displayed scale (polarity profile only)
    * int //max// -- Maximum of the displayed scale (polarity profile only)
    * boolean //labels// -- Use the first data series as label
    * int //labelwidth// -- width of the label (in pixels)
    * array //limit// -- Display limits at the specified values (polarity profile only)
    * array //limitcolor// -- background colors for the different areas between the borders (only polarity profile, specified as HTML color codes, e.g. ''%%'0000FF'%%'' for blue)
    * array //rowcolor// -- character colors for the data series (specified as HTML color codes)



====== Examples =====

For example a multidimensional array could look like this:

<code php>
array(
  array(1,2,3,4,5,6,7,8,10), // first data series
  array(1,4,2,3,5,7,2,1,2) // second data series
)
</code>

An array with the options can look like this:

<code php>
array(
  'width' => 320,
  'height' => 120,
  'min' => 1,
  'max' => 7,
  'labels' => true,
  'limit' => array(2,4)
)
</code>

A diagram can be an output as follows:

<code php>
$src = diagram2('polar',
  array(
    array('Alpha', 'Beta', 'Gamma', 'Delta', 'Epsilon', 'Zeta', 'Theta', 'Eta', 'Phi'), // Labels
    array(1,4,2,5,3,7,2,1,2) // Data
  ),
  array(
    'width' => 320,
    'height' => 120,
    'labelwidth' => 100,
    'min' => 1,
    'max' => 7,
    'labels' => true,
    'limit' => array(2,5,7),
    'limitcolor' => array('FFFF99', 'FFFFFF', 'FFFF99')
  )
);
html($src);
</code>
